package com.jgzj.example.export.format;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.util.function.Function;

/**
 * @description: 格式化
 * @author: 子木
 * @since: 2021/05/16
 */
public class ExportDefaultFormat implements Function<ExportFormatReq, Object> {
    @Override
    public Object apply(ExportFormatReq defaultFormatReq) {
        JSONObject json = (JSONObject)JSONObject.toJSON(defaultFormatReq.getData());
        return JSON.toJavaObject(json,defaultFormatReq.getClazz());
    }
}